﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Main
{
    public class PDUSession
    {
        private int applicationId;
        private string addresseDestination;
        private string data;

        public int ApplicationId { get { return applicationId; } set { applicationId = value; } }

        public string AddresseDestination { get { return addresseDestination; } set { addresseDestination = value; } }

        public string Data { get { return data; } set { data = value; } }

        public static List<PDUSession> ReadFichier(string fichier)
        {
            List<PDUSession> listeLigne = new List<PDUSession>();

            int counter = 0;
            string line;

            StringReader file = new StringReader(fichier);

            while ((line = file.ReadLine()) != null)
            {
                PDUSession ligneFS = new PDUSession();

                string[] args = line.Split(';');

                ligneFS.applicationId = Convert.ToInt32(args[0]);
                ligneFS.addresseDestination = args[1];
                ligneFS.data = args[2];

                listeLigne.Add(ligneFS);
                counter++;
            }

            file.Close();

            return listeLigne;
        }
    }
}
